From 1245c85986da52c26e4ad7de63e52cd0a2400d54 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Mon, 20 Jul 2026 22:16:15 +0000 Subject: [PATCH] Create, document, index, and trigger PANTGRUNT_EVENT_LOG --- db/schemas/housekeeping/indexes/Makefile | 1 + .../indexes/create/pantgrunt_event_log.m4 | 29 ++ .../indexes/drop/pantgrunt_event_log.m4 | 24 ++ db/schemas/housekeeping/tables/Makefile | 1 + .../tables/create/pantgrunt_event_log.m4 | 61 +++++ db/schemas/lib/triggers/Makefile | 3 +- .../triggers/create/pantgrunt_event_log.m4 | 49 ++++ .../lib/triggers/drop/pantgrunt_event_log.m4 | 23 ++ doc/src/epilog.inc.m4 | 37 +++ doc/src/housekeeping.m4 | 1 + doc/src/housekeeping/pantgrunt_event_log.m4 | 249 ++++++++++++++++++ 11 files changed, 477 insertions(+), 1 deletion(-) create mode 100644 db/schemas/housekeeping/indexes/create/pantgrunt_event_log.m4 create mode 100644 db/schemas/housekeeping/indexes/drop/pantgrunt_event_log.m4 create mode 100644 db/schemas/housekeeping/tables/create/pantgrunt_event_log.m4 create mode 100644 db/schemas/lib/triggers/create/pantgrunt_event_log.m4 create mode 100644 db/schemas/lib/triggers/drop/pantgrunt_event_log.m4 create mode 100644 doc/src/housekeeping/pantgrunt_event_log.m4 diff --git a/db/schemas/housekeeping/indexes/Makefile b/db/schemas/housekeeping/indexes/Makefile index 3bb4c39..67184df 100644 --- a/db/schemas/housekeeping/indexes/Makefile +++ b/db/schemas/housekeeping/indexes/Makefile @@ -24,6 +24,7 @@ ORDER := aggression_event_log \ chimps_on_tikis \ community_membership_update_log \ food_variations \ + pantgrunt_event_log \ tlk_brecord_notes_codes ## diff --git a/db/schemas/housekeeping/indexes/create/pantgrunt_event_log.m4 b/db/schemas/housekeeping/indexes/create/pantgrunt_event_log.m4 new file mode 100644 index 0000000..07ed8ce --- /dev/null +++ b/db/schemas/housekeeping/indexes/create/pantgrunt_event_log.m4 @@ -0,0 +1,29 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +CREATE UNIQUE INDEX IF NOT EXISTS + "On PANTGRUNT_EVENT_LOG, Year must be unique" + ON pantgrunt_event_log + (year); + + diff --git a/db/schemas/housekeeping/indexes/drop/pantgrunt_event_log.m4 b/db/schemas/housekeeping/indexes/drop/pantgrunt_event_log.m4 new file mode 100644 index 0000000..c699c5c --- /dev/null +++ b/db/schemas/housekeeping/indexes/drop/pantgrunt_event_log.m4 @@ -0,0 +1,24 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +DROP INDEX IF EXISTS "On PANTGRUNT_EVENT_LOG, Year must be unique"; diff --git a/db/schemas/housekeeping/tables/Makefile b/db/schemas/housekeeping/tables/Makefile index 6336b18..4cdcd54 100644 --- a/db/schemas/housekeeping/tables/Makefile +++ b/db/schemas/housekeeping/tables/Makefile @@ -25,6 +25,7 @@ ORDER := aggression_event_log \ chimps_on_tikis \ community_membership_update_log \ food_variations \ + pantgrunt_event_log \ tlk_brecord_notes_codes ## diff --git a/db/schemas/housekeeping/tables/create/pantgrunt_event_log.m4 b/db/schemas/housekeeping/tables/create/pantgrunt_event_log.m4 new file mode 100644 index 0000000..df612aa --- /dev/null +++ b/db/schemas/housekeeping/tables/create/pantgrunt_event_log.m4 @@ -0,0 +1,61 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`tablemacros.m4')dnl +include(`grants.m4')dnl +dnl + +CREATE TABLE pantgrunt_event_log ( + key_column(`PANTGRUNT_EVENT_LOG', `ID', INTEGER) + ,year INTEGER NOT NULL + ,arecswahili TEXT NOT NULL + notonlyspaces_check(`ARecSwahili') + ,arecenglishnotes TEXT NOT NULL + notonlyspaces_check(`ARecEnglishNotes') + ,arecasr TEXT NOT NULL + notonlyspaces_check(`ARecASR') + ,brecenglish TEXT NOT NULL + notonlyspaces_check(`BRecEnglish') + ,brecasrextractions TEXT NOT NULL + notonlyspaces_check(`BRecASRExtractions') + ,mainfasrextractions TEXT NOT NULL + notonlyspaces_check(`MAINFASRExtractions') + ,mainf TEXT NOT NULL + notonlyspaces_check(`MAINF') + ,adolescentstudytalliespusey TEXT NOT NULL + notonlyspaces_check(`AdolescentStudyTalliesPusey') + ,greengrass TEXT NOT NULL + notonlyspaces_check(`Greengrass') + ,murray TEXT NOT NULL + notonlyspaces_check(`Murray') + ,omally TEXT NOT NULL + notonlyspaces_check(`OMally') + ,heintz TEXT NOT NULL + notonlyspaces_check(`Heintz') + ,OBryan TEXT NOT NULL + notonlyspaces_check(`OBryan') + ,schroepfer TEXT NOT NULL + notonlyspaces_check(`Schroepfer') + ,notes TEXT NOT NULL + notonlyspaces_check(`notes') +); + +grant_priv(`PANTGRUNT_EVENT_LOG') diff --git a/db/schemas/lib/triggers/Makefile b/db/schemas/lib/triggers/Makefile index 56bbf85..773dc72 100644 --- a/db/schemas/lib/triggers/Makefile +++ b/db/schemas/lib/triggers/Makefile @@ -60,7 +60,8 @@ ORDER := comm_ids \ chimps_on_tikis \ tlk_brecord_notes_codes \ community_membership_update_log \ - food_variations + food_variations \ + pantgrunt_event_log DROP_EXISTING := true diff --git a/db/schemas/lib/triggers/create/pantgrunt_event_log.m4 b/db/schemas/lib/triggers/create/pantgrunt_event_log.m4 new file mode 100644 index 0000000..ffc00ab --- /dev/null +++ b/db/schemas/lib/triggers/create/pantgrunt_event_log.m4 @@ -0,0 +1,49 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify it +dnl under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Triggers for the pantgrunt_event_log table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`macros.m4')dnl + + +RAISE INFO 'pantgrunt_event_log_update_func'; +CREATE OR REPLACE FUNCTION pantgrunt_event_log_update_func () + RETURNS trigger + LANGUAGE plpgsql + sdb_function_set_search_path + AS $$ + BEGIN + -- Function for pantgrunt_event_log update trigger + -- + -- AGPL_notice(` --', `2026', + `The Meme Factory, Inc., www.karlpinc.com') + + cannot_change(`PANTGRUNT_EVENT_LOG', `ID') + + RETURN NULL; + END; +$$; + + +RAISE INFO 'pantgrunt_event_log_update_trigger'; +CREATE TRIGGER pantgrunt_event_log_update_trigger + AFTER INSERT OR UPDATE + ON pantgrunt_event_log FOR EACH ROW + EXECUTE PROCEDURE pantgrunt_event_log_update_func(); diff --git a/db/schemas/lib/triggers/drop/pantgrunt_event_log.m4 b/db/schemas/lib/triggers/drop/pantgrunt_event_log.m4 new file mode 100644 index 0000000..e430dfd --- /dev/null +++ b/db/schemas/lib/triggers/drop/pantgrunt_event_log.m4 @@ -0,0 +1,23 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Drop triggers for pantgrunt_event_log table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl + +DROP FUNCTION IF EXISTS pantgrunt_event_log_update_func() CASCADE; diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index f429ef4..8fab327 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -678,6 +678,43 @@ elo_ranks_daily_rst(sdb_male, MT)dnl .. |OBS_PERIODS.Period| replace:: :ref:`Period ` +.. |PANTGRUNT_EVENT_LOG| replace:: + :ref:`PANTGRUNT_EVENT_LOG ` +.. |PANTGRUNT_EVENT_LOG.ID| replace:: + :ref:`ID ` +.. |PANTGRUNT_EVENT_LOG.Year| replace:: + :ref:`Year ` +.. |PANTGRUNT_EVENT_LOG.ARecSwahili| replace:: + :ref:`ARecSwahili ` +.. |PANTGRUNT_EVENT_LOG.ARecEnglishNotes| replace:: + :ref:`ARecEnglishNotes ` +.. |PANTGRUNT_EVENT_LOG.ARecASR| replace:: + :ref:`ARecASR ` +.. |PANTGRUNT_EVENT_LOG.BRecEnglish| replace:: + :ref:`BRecEnglish ` +.. |PANTGRUNT_EVENT_LOG.BRecASRExtractions| replace:: + :ref:`BRecASRExtractions ` +.. |PANTGRUNT_EVENT_LOG.MAINFASRExtractions| replace:: + :ref:`MAINFASRExtractions ` +.. |PANTGRUNT_EVENT_LOG.MAINF| replace:: + :ref:`MAINF ` +.. |PANTGRUNT_EVENT_LOG.AdolescentStudyTalliesPusey| replace:: + :ref:`AdolescentStudyTalliesPusey ` +.. |PANTGRUNT_EVENT_LOG.Greengrass| replace:: + :ref:`Greengrass ` +.. |PANTGRUNT_EVENT_LOG.Murray| replace:: + :ref:`Murray ` +.. |PANTGRUNT_EVENT_LOG.OMally| replace:: + :ref:`OMally ` +.. |PANTGRUNT_EVENT_LOG.Heintz| replace:: + :ref:`Heintz ` +.. |PANTGRUNT_EVENT_LOG.OBryan| replace:: + :ref:`OBryan ` +.. |PANTGRUNT_EVENT_LOG.Schroepfer| replace:: + :ref:`Schroepfer ` +.. |PANTGRUNT_EVENT_LOG.Notes| replace:: + :ref:`Notes ` + .. |PANTGRUNTS| replace:: :ref:`PANTGRUNTS ` .. |PANTGRUNTS.EID| replace:: :ref:`EID ` diff --git a/doc/src/housekeeping.m4 b/doc/src/housekeeping.m4 index 6be47b6..ebe9b75 100644 --- a/doc/src/housekeeping.m4 +++ b/doc/src/housekeeping.m4 @@ -38,4 +38,5 @@ The tables in this section are all in the ``housekeeping`` schema. housekeeping/chimps_on_tikis.rst housekeeping/food_variations.rst housekeeping/community_membership_update_log.rst + housekeeping/pantgrunt_event_log.rst housekeeping/tlk_brecord_notes_codes.rst diff --git a/doc/src/housekeeping/pantgrunt_event_log.m4 b/doc/src/housekeeping/pantgrunt_event_log.m4 new file mode 100644 index 0000000..c6623f1 --- /dev/null +++ b/doc/src/housekeeping/pantgrunt_event_log.m4 @@ -0,0 +1,249 @@ +.. Copyright (C) 2026 The Meme Factory, Inc. www.karlpinc.com + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +.. M4 setup +include(constants.m4)dnl +include(macros.m4)dnl +sdb_rst_quotes(`on')dnl +sdb_generated_rst()dnl + +.. _PANTGRUNT_EVENT_LOG: + +PANTGRUNT_EVENT_LOG +------------------- + +.. |PANTGRUNT_EVENT_LOG_summary| replace:: + Each row contains information on pantgrunt updates that occurred + within a given year. + There is, at most, one row per year. + +|PANTGRUNT_EVENT_LOG_summary| + +The following text strings carry some meaning: + +``F-F`` + female-to-female pantgrunts extracted +``F-M`` + female-to-male pantrgrunts extracted +``M-M`` + male-to-male pantgrunts extracted +``NA`` + No data available to extract – needs to be completed + + +.. contents:: + :depth: 2 + + +.. _PANTGRUNT_EVENT_LOG.ID: + +ID (IDentifier) +``````````````` + +.. |PANTGRUNT_EVENT_LOG.ID_summary| replace:: |idcol| + +|PANTGRUNT_EVENT_LOG.ID_summary| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Year: + +Year +```` + +.. |PANTGRUNT_EVENT_LOG.Year_summary| replace:: + The year of interest. + +|PANTGRUNT_EVENT_LOG.Year_summary| +|notnull| + + +.. _PANTGRUNT_EVENT_LOG.ARecSwahili: + +ARecSwahili +``````````` + +.. |PANTGRUNT_EVENT_LOG.ARecSwahili_summary| replace:: + Text having to do with the Swahili version of the A Record. + +|PANTGRUNT_EVENT_LOG.ARecSwahili_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.ARecEnglishNotes: + +ARecEnglishNotes +```````````````` + +.. |PANTGRUNT_EVENT_LOG.ARecEnglishNotes_summary| replace:: + Text having to do with the English notes in the A Record. + +|PANTGRUNT_EVENT_LOG.ARecEnglishNotes_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.ARecASR: + +ARecASR +``````` + +.. |PANTGRUNT_EVENT_LOG.ARecASR_summary| replace:: + Text having to do with the ASR of the A Record. + +|PANTGRUNT_EVENT_LOG.ARecASR_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.BRecEnglish: + +BRecEnglish +``````````` + +.. |PANTGRUNT_EVENT_LOG.BRecEnglish_summary| replace:: + Text having to do with the English version of the B Record. + +|PANTGRUNT_EVENT_LOG.BRecEnglish_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.BRecASRExtractions: + +BRecASRExtractions +`````````````````` + +.. |PANTGRUNT_EVENT_LOG.BRecASRExtractions_summary| replace:: + Text having to do with the ASR extractions from the B Record. + +|PANTGRUNT_EVENT_LOG.BRecASRExtractions_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.MAINFASRExtractions: + +MAINFASRExtractions +``````````````````` + +.. |PANTGRUNT_EVENT_LOG.MAINFASRExtractions_summary| replace:: + Text having to do with the ASR extractions from the Mother Infant project. + +|PANTGRUNT_EVENT_LOG.MAINFASRExtractions_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.MAINF: + +MAINF +````` + +.. |PANTGRUNT_EVENT_LOG.MAINF_summary| replace:: + Text having to do with the Mother Infant project. + +|PANTGRUNT_EVENT_LOG.MAINF_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.AdolescentStudyTalliesPusey: + +AdolescentStudyTalliesPusey +``````````````````````````` + +.. |PANTGRUNT_EVENT_LOG.AdolescentStudyTalliesPusey_summary| replace:: + Text having to do with Anne Pusey's adolescent study tallies. + +|PANTGRUNT_EVENT_LOG.AdolescentStudyTalliesPusey_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Greengrass: + +Greengrass +`````````` + +.. |PANTGRUNT_EVENT_LOG.Greengrass_summary| replace:: + Text having to do with the Greengrass. + +|PANTGRUNT_EVENT_LOG.Greengrass_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Murray: + +Murray +`````` + +.. |PANTGRUNT_EVENT_LOG.Murray_summary| replace:: + Text having to do with Murray. + +|PANTGRUNT_EVENT_LOG.Murray_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.OMally: + +OMally +`````` + +.. |PANTGRUNT_EVENT_LOG.OMally_summary| replace:: + Text having to do with OMally. + +|PANTGRUNT_EVENT_LOG.OMally_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Heintz: + +Heintz +`````` + +.. |PANTGRUNT_EVENT_LOG.Heintz_summary| replace:: + Text having to do with Heintz. + +|PANTGRUNT_EVENT_LOG.Heintz_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.OBryan: + +OBryan +`````` + +.. |PANTGRUNT_EVENT_LOG.OBryan_summary| replace:: + Text having to do with OBryan. + +|PANTGRUNT_EVENT_LOG.OBryan_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Schroepfer: + +Schroepfer +`````````` + +.. |PANTGRUNT_EVENT_LOG.Schroepfer_summary| replace:: + Text having to do with the Schroepfer. + +|PANTGRUNT_EVENT_LOG.Schroepfer_summary| +|notonlyspaces| |notnull| + + +.. _PANTGRUNT_EVENT_LOG.Notes: + +Notes +````` + +.. |PANTGRUNT_EVENT_LOG.Notes_summary| replace:: + Other notes. + +|PANTGRUNT_EVENT_LOG.Notes_summary| +|notonlyspaces| |notnull| -- 2.34.1